import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';

import 'res/colors.dart';

class AppTheme {
  ThemeData get defaultTheme => _defaultTheme;

  static TextTheme get textTheme => TextTheme(
        titleLarge: TextStyle(
          fontSize: 30.sp,
          fontWeight: FontWeight.w700,
          color: ColorStyle.black,
        ),
        titleMedium: TextStyle(
          fontSize: 16.sp,
          fontWeight: FontWeight.w400,
          color: ColorStyle.black,
        ),
        titleSmall: TextStyle(
          fontSize: 14.sp,
          fontWeight: FontWeight.w400,
          color: ColorStyle.black,
        ),
        bodyLarge: TextStyle(
          fontSize: 14.sp,
          fontWeight: FontWeight.w400,
          color: ColorStyle.black,
        ),
        bodyMedium: TextStyle(
          fontSize: 14.sp,
          fontWeight: FontWeight.w400,
          color: ColorStyle.black,
        ),
        bodySmall: TextStyle(
          fontSize: 12.sp,
          fontWeight: FontWeight.w400,
          color: ColorStyle.black,
        ),
      );

  static TextTheme get textThemeWhite => TextTheme(
        titleLarge: TextStyle(
          fontSize: 22.sp,
          fontWeight: FontWeight.w700,
          color: ColorStyle.white,
        ),
        titleMedium: TextStyle(
          fontSize: 16.sp,
          fontWeight: FontWeight.w600,
          color: ColorStyle.white,
        ),
        titleSmall: TextStyle(
          fontSize: 14.sp,
          fontWeight: FontWeight.w400,
          color: ColorStyle.white,
        ),
        bodyLarge: TextStyle(
          fontSize: 16.sp,
          fontWeight: FontWeight.w400,
          color: ColorStyle.white,
        ),
        bodyMedium: TextStyle(
          fontSize: 14.sp,
          fontWeight: FontWeight.w400,
          color: ColorStyle.white,
        ),
        bodySmall: TextStyle(
          fontSize: 12.sp,
          fontWeight: FontWeight.w400,
          color: ColorStyle.white,
        ),
      );

  final ThemeData _defaultTheme = ThemeData.light(useMaterial3: true).copyWith(
    colorScheme: const ColorScheme.light(
      primary: ColorStyle.primary,
      secondary: ColorStyle.primary,
    ),
    primaryColor: ColorStyle.primary,
    platform: TargetPlatform.iOS,
    scaffoldBackgroundColor: ColorStyle.scaffoldBackgroundColor,
    appBarTheme: AppBarTheme(
      elevation: 0,
      centerTitle: true,
      backgroundColor: Colors.black,
      scrolledUnderElevation: 0,
      titleTextStyle: textTheme.titleMedium?.copyWith(
        color: ColorStyle.color333333,
        fontSize: 18,
        height: 18 / 25,
      ),
    ),
    textTheme: textTheme,
    floatingActionButtonTheme: FloatingActionButtonThemeData(
        backgroundColor: ColorStyle.primary,
        foregroundColor: Colors.white,
        shape: const CircleBorder(),
        elevation: 0,
        highlightElevation: 0,
        hoverElevation: 0,
        focusElevation: 0,
        disabledElevation: 0,
        sizeConstraints: BoxConstraints(minWidth: 55.w, minHeight: 55.w)),
    dividerColor: ColorStyle.dividerColor,
    dividerTheme:
        const DividerThemeData(color: ColorStyle.dividerColor, space: 1),
    cardTheme: CardTheme(
      color: Colors.white,
      elevation: 0,
      shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(20)),
      surfaceTintColor: Colors.white,
    ),
    snackBarTheme: const SnackBarThemeData(
      backgroundColor: Colors.white,
      contentTextStyle: TextStyle(
        color: ColorStyle.primary,
      ),
    ),
    textButtonTheme: TextButtonThemeData(
      style: TextButton.styleFrom(
        textStyle: const TextStyle(
          color: ColorStyle.primary,
        ),
        padding: EdgeInsets.zero,
        elevation: 0,
        shape: const LinearBorder(),
        fixedSize: const Size(double.infinity, 55),
      ),
    ),
    outlinedButtonTheme: OutlinedButtonThemeData(
      style: OutlinedButton.styleFrom(
        backgroundColor: Colors.white,
        side: const BorderSide(color: ColorStyle.primary),
        elevation: 0,
      ),
    ),
    elevatedButtonTheme: ElevatedButtonThemeData(
      style: ElevatedButton.styleFrom(
        elevation: 0,
        textStyle: textTheme.titleMedium?.copyWith(color: Colors.white),
        shape: RoundedRectangleBorder(
          borderRadius: BorderRadius.circular(25),
        ),
        backgroundColor: ColorStyle.primary,
        foregroundColor: Colors.white,
        disabledBackgroundColor: ColorStyle.primary.withOpacity(0.12),
      ),
    ),
    bottomNavigationBarTheme: const BottomNavigationBarThemeData(
      elevation: 0,
      backgroundColor: Colors.black,
      unselectedItemColor: Color(0xFFC0C0C0),
      selectedItemColor: Colors.white,
      type: BottomNavigationBarType.fixed,
    ),
  );
}
